<template>
  <div id="liveMonitorCon">
    <div class="header">
      <!-- <span class="tit">监控状态</span> -->
      <!-- <el-select v-model="value" placeholder="请选择">
        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
        </el-option>
      </el-select>-->
      <section class="section_01">
        <div class="section_box">
          <radio_group01 :radio_values="options" v-model="value" />
          <section class="input_group">
            <input
              type="text"
              v-model.trim="input01"
              placeholder="输入达人名称或抖音号查询"
              @keyup.enter="search_input1()"
            />
            <div @click="search_input1()" class="imgBox">
              <!-- <img src="@/assets/meng/search01.png" /> -->
            </div>
          </section>
        </div>
        <div>
          <button v-if="!del&&!LiveMonitoring.length" class="but_admin">
            <img src="@/assets/liu/adminIcon.png" />
            管理
          </button>
          <button v-if="!del&&LiveMonitoring.length" class="but_admin" @click="but_admin">
            <img src="@/assets/liu/adminIcon.png" />
            管理
          </button>
          <button v-if="del&&LiveMonitoring.length" class="but_complete" @click="but_admin">完成</button>
          <button class="add" @click="add">
            <img src="@/assets/liu/add.png" />
            添加监测
          </button>
        </div>
      </section>
    </div>

    <div
      v-if="listLoading"
      style="margin-top: 30px; margin-bottom: 100px"
      v-loading="listLoading"
      element-loading-text="拼命加载中"
      element-loading-spinner="el-icon-loading"
    ></div>
    <ul v-if="LiveMonitoring.length" class="ul">
      <li v-for="(item, i) in LiveMonitoring" :key="i + 'i'">
        <div class="item_box">
          <div class="top">
            <img
              v-if="item.monitoringState == 1"
              class="gif"
              src="@/assets/liu/gif.png"
              @click="go_to_page01(item.authorId)"
            />
            <img @click="go_to_page01(item.authorId)" :src="item.logo" class="logo" />

            <div class="cen">
              <p @click="go_to_page01(item.authorId)" class="name">{{ item.nickName }}</p>
              <p>抖音号：{{ item.uniqueId }}</p>
              <div></div>
              <!-- <p>粉丝数：{{ format_num(item.totalFans) }}</p> -->
            </div>
            <div class="rig">
              <button
                v-if="
                  (!del && item.monitoringState == 0) ||
                    (!del && item.monitoringState == 1)
                "
                @click="LiveMonitorCancel(item.id)"
              >取消监测</button>
              <button v-if="del" @click="LiveMonitorDel(item.id, item.monitoringState)">删除</button>
              <button
                v-if="
                  (!del && item.monitoringState == 3) ||
                    (!del && item.monitoringState == 2)
                "
                class="again"
                @click="
                  LiveMonitorAgain(item.authorId, item.nickName, item.uniqueId)
                "
              >重新监测</button>
              <!-- <p  v-if=" item.monitoringState==0" class="notStarted">未开始</p>
                <p class="rigMonitoring" v-if="item.monitoringState == 1">
                  <img src="@/assets/liu/Monitoring.png" />
                  监控中
                </p>
                <p v-if="item.monitoringState == 2" class="notStarted">已完成</p>
              <p v-if="item.monitoringState == 3" class="notStarted">已取消</p>-->
            </div>
          </div>
          <div class="bot">
            <div class="monitor">
              <p class="timeSlot">监控时间段</p>
              <p class="Sessions" @click="monitorList(i, item.id)">
                已监控
                <span>{{ item.monitorCount }}</span>
                场
              </p>
            </div>
            <p class="monitorTime">
              {{
              timestamp(item.begin_timestamp, "Y-M-D h:m") +
              "至" +
              timestamp(item.end_timestamp, "Y-M-D h:m")
              }}
            </p>
            <!-- <div class="delCancel"> -->
            <!-- <span class="del" @click="LiveMonitorDel(item.id, item.monitoringState)">删除</span> -->
            <el-dialog :visible.sync="dialogVisible" v-if="num">
              <p class="p1">删除监控</p>
              <span
                :class="
                  monitoringState1 == 3 || monitoringState1 == 2 ? 'span' : ''
                "
              >确定将该达人移除监测列表吗？</span>
              <p class="p2" v-if="monitoringState1 != 3 && monitoringState1 != 2">
                明细：已监测
                <span>{{ num.usageTime }}</span>
                个小时，共花费
                <span>{{ num.useNum }}</span>
                次监测次数
              </p>
              <p class="p2" v-if="monitoringState1 != 3 && monitoringState1 != 2">
                返还：剩余
                <span>{{ num.returnNum }}</span>
                次监测次数可返还
              </p>
              <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialog">确 定</el-button>
                <el-button class="color" @click="dialogVisible = false">取 消</el-button>
              </span>
            </el-dialog>
            <!-- <span class="rigbor"></span> -->
            <!-- <span v-if="item.monitoringState == 3 || item.monitoringState == 2" class="again" @click="
                  LiveMonitorAgain(item.authorId, item.nickName, item.uniqueId)
            ">重新监测</span>-->
            <!-- <span v-if="item.monitoringState == 0 || item.monitoringState == 1" class="cancel"
            @click="LiveMonitorCancel(item.id)">取消监测</span>-->
            <el-dialog :visible.sync="dialogVisible1" v-if="num">
              <p class="p1">取消监控</p>
              <span>确定将该达人取消监测列表吗？</span>
              <p class="p2">
                明细：已监测
                <span>{{ num.usageTime }}</span>
                个小时，共花费
                <span>{{ num.useNum }}</span>
                次监测次数
              </p>
              <p class="p2">
                返还：剩余
                <span>{{ num.returnNum }}</span>
                次监测次数可返还
              </p>
              <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="dialog1">确 定</el-button>
                <el-button class="color" @click="dialogVisible1 = false">取 消</el-button>
              </span>
            </el-dialog>
            <!-- </div> -->
          </div>
        </div>
      </li>
    </ul>
    <!-- 直播间弹窗 -->
    <el-dialog
      :visible.sync="showHotRoom"
      v-if="showHotRoom"
      class="dialog01"
      custom-class="buyDialog"
      width="572px"
      @close="close"
    >
      <div class="hotRoomBox">
        <p class="title">直播监测</p>
        <p class="txt">针对达人直播时的数据分析，提供实时弹幕、销量、在线人数、音浪收入、等数据监测。</p>
        <section class="input_group">
          <input
            type="text"
            v-model.trim="input02"
            placeholder="输入达人名称或抖音号查询"
            @keyup.enter="search_input()"
          />
          <div @click="search_input()" class="imgBoxtwo">
            <img src="@/assets/meng/search01.png" />
          </div>
        </section>
        <div
          v-if="table_data.length == 0 && roomLoading"
          style="margin-top: 30px; margin-bottom: 100px"
          v-loading="roomLoading"
          element-loading-text="拼命加载中"
          element-loading-spinner="el-icon-loading"
        ></div>
        <div
          v-if="showInclude && !roomLoading && !table_data.length"
          style="position: relative; height:300px"
        >
          <div class="zw">
            <img src="@/assets/liu/zw.png" />
            <p>暂无数据</p>
          </div>
        </div>
        <ul class="Talent_list" v-if="table_data.length != 0">
          <li
            :class="index == item.unique_id ? 'active_Talent' : ''"
            v-for="(item, i) in table_data"
            :key="i + 'q'"
            @click="choiceTalent(item.unique_id, item.author_id)"
          >
            <div>
              <img :src="item.logo" v-errorImg:talent />
            </div>
            <div>
              <p>{{ item.nickname }}</p>
              <p>抖音号：{{ item.unique_id }}</p>
              <!-- <p>简介：{{ item.introduce }}</p> -->
            </div>
            <div v-if="index == item.unique_id">
              <img src="@/assets/liu/Couplet.png" />
            </div>
          </li>
        </ul>
        <!-- <div class="duration">
          监控时长 <span v-if="choiceValue.length">共{{ choiceValue }}监测</span>
        </div>-->
        <div class="duration" v-if="choiceValue.length">
          监控时长
          <span>共{{ choiceValue }}监测</span>
        </div>
        <div class="duration" v-else>
          监控时长
          <span>共0小时监测</span>
        </div>
        <div class="choice">
          <button :class="choiceValue == '6小时' ? 'active' : ''" @click="choice('6小时')">6小时</button>
          <button :class="choiceValue == '12小时' ? 'active' : ''" @click="choice('12小时')">12小时</button>
          <button
            :class="choiceValue == '24小时' && Hour != 0 ? 'active' : ''"
            @click="choice('24小时')"
          >24小时</button>
          <button :class="choiceValue == '48小时' ? 'active' : ''" @click="choice('48小时')">48小时</button>
          <button :class="custom ? 'active' : ''" @click="choice('自定义')">自定义</button>
        </div>
        <div style="text-align: center">
          <el-date-picker
            v-model="value1"
            v-show="custom"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始日期"
            @change="changeTime"
            value-format="timestamp"
            :picker-options="pickeroptions"
            end-placeholder="结束日期"
          ></el-date-picker>
        </div>
        <p class="tips">开启直播监测后，则在监测时间段内，监测所有直播信息。若在监测时间段内没有直播，则直播监测也视为完成。</p>
        <div class="remind">
          <span>直播提醒</span>
          <el-switch v-model="switchValue" active-color="#fd7f2c" inactive-color="#fbfbfb"></el-switch>
        </div>
        <p v-if="switchValue" class="push">开播时我们会通过掌上数据公众号为您推送消息。</p>
        <p class="rule">扣款规则:每六小时扣一次监测次数，不满六小时按六小时计算。点击取消监测后，若监测已开始，则退还未使用的监测次数。若监测未开始，则退还全部次数。</p>
        <p v-if="frequency" class="frequency">
          本次监测消耗
          <span>{{ frequency.useNum }}</span>
          次直播监测次数，剩余
          <span>{{ frequency.surplus }}</span>次直播监测次数。
        </p>
        <div class="testing">
          <button
            :class="
              table_data.length == 0 || !author_id || frequency == 0
                ? 'disabled'
                : ''
            "
            v-bind:disabled="
              table_data.length == 0 || !author_id || frequency == 0
            "
            @click="startMonitoring"
          >开始监测</button>
        </div>
      </div>
    </el-dialog>
    <!-- 直播间弹窗 -->
    <div class="talentPopupList">
      <el-dialog :visible.sync="popupList" custom-class="buyDialog">
        <div class="popupList">
          <p class="complete" v-if="son && son.monitoringState == 2">监测已完成</p>
          <p class="complete" v-if="son && son.monitoringState == 1">监测中</p>
          <p class="complete" v-if="son && son.monitoringState == 0">监测未开始</p>
          <p class="complete" v-if="son && son.monitoringState == 3">监测已取消</p>
          <ul>
            <li class="first" v-if="son">
              <div class="logo">
                <img :src="son.logo" @click="talentDetails(son.authorId)" />
              </div>
              <div class="popupListInfo">
                <p @click="talentDetails(son.authorId)">{{ son.nickName }}</p>
                <p>抖音号：{{ son.uniqueId }}</p>
                <!-- <p>粉丝数：{{ format_num(son.totalFans) }}</p> -->
              </div>
              <div>
                共监测到
                <span style="color:#fd7f2c;">{{ son.monitorCount }}</span> 场直播
              </div>
            </li>
            <li v-for="(sonItem, ind) in sonALL" :key="ind + 'i'" class="rest">
              <div class="sonLogo">
                <img
                  :src="sonItem.logo"
                  @click="
                    todetails(sonItem.roomId, sonItem.authorId, sonItem.status)
                  "
                />
                <div v-if="sonItem.status == 1" class="livingGif1">
                  <p class="livingGif">
                    <span></span>
                    <span></span>
                    <span></span>
                    <span></span>
                  </p>
                </div>
              </div>
              <div v-if="sonItem" class="sonListInfo">
                <p
                  @click="
                    todetails(sonItem.roomId, sonItem.authorId, sonItem.status)
                  "
                >{{ sonItem.roomTitle }}</p>
                <!-- <p>
                  直播时长{{
                    format_time(
                      (sonItem.end_timestamp - sonItem.begin_timestamp) * 1000
                    )
                  }}
                </p>-->
                <p v-if="sonItem.status != 1">{{ sonItem.beginTime }} / {{ sonItem.endTime }}</p>
                <p v-if="sonItem.status == 1">{{ sonItem.beginTime }} / --</p>
              </div>
              <div class="pu" v-if="sonItem.isShop == 0">
                <p>{{ sonItem.livefanRate + "%" }}</p>
                <p>转粉率</p>
              </div>
              <div class="pu" v-else>
                <p>{{ sonItem.avglooktime }}</p>
                <p>平均观看时长</p>
              </div>
              <div class="pu" v-if="sonItem.isShop == 0">
                <p>{{ format_num(sonItem.avgonlinePeople) }}</p>
                <p>平均在线人数</p>
              </div>
              <div class="pu" v-else>
                <p>{{ format_num(sonItem.totalPeople) }}</p>
                <p>累计观看人数</p>
              </div>

              <div class="pu" v-if="sonItem.isShop == 0">
                <p>{{ format_num(sonItem.totalPeople) }}</p>
                <p>累计观看人数</p>
              </div>
              <div class="pu" v-else>
                <p>{{ format_num(sonItem.liveproduct) }}</p>
                <p>带货商品</p>
              </div>
              <div class="pu" v-if="sonItem.isShop == 0">
                <p>{{ format_num(sonItem.peoplePeak) }}</p>
                <p>观看人数峰值</p>
              </div>
              <div class="pu" v-else>
                <p>{{ format_num(sonItem.livevolume) }}</p>
                <p>直播销量</p>
              </div>
              <!-- <button class="details" @click="
                  todetails(sonItem.roomId, sonItem.authorId, sonItem.status)
                ">
                查看详情
              </button>-->
            </li>
          </ul>
          <div class="pageBox" v-if="total > 5">
            <el-pagination
              background
              layout="prev, pager, next, jumper"
              :total="total"
              :page-size="5"
              :current-page="page"
              @current-change="get_data"
              :hide-on-single-page="true"
            ></el-pagination>
          </div>
          <div v-if="sonALL && sonALL.length == 0 && !loading" class="zw">
            <img src="@/assets/liu/zw.png" />
            <p>暂无数据</p>
          </div>
          <div
            v-if="sonlistLoading"
            class="sonlistLoading"
            v-loading="sonlistLoading"
            element-loading-text="拼命加载中"
            element-loading-spinner="el-icon-loading"
          ></div>
        </div>
      </el-dialog>
    </div>

    <div v-if="!LiveMonitoring.length && !listLoading" class="zw">
      <img src="@/assets/liu/zw.png" />
      <p>暂无数据</p>
    </div>
  </div>
</template>

<script>
export default {
  props: {},
  components: {},
  data() {
    return {
      del: false,
      value09: '监测中',
      sonlistLoading: false,
      setInterval: null,
      shake: false,
      num: null,
      loading: true,
      sonALL: [],
      total: null,
      page: 1,
      son: null,
      id: '',
      id1: '',
      id2: '',
      dialogVisible: false,
      dialogVisible1: false,
      popupList: false, //点击监控场次出现的弹窗
      showInclude: false,
      listLoading: true,
      LiveMonitoring: [],
      // 直播监测列表参数
      AuthorId: '',
      MonitoringState: '2',
      monitoringState1: '',
      NickName: '',
      UniqueId: '',
      Hour: 6, //监控时间
      frequency: null, //消耗次数
      Start: '', //监控开始时间
      Stop: '', //监控结束时间
      author_id: null, //达人id
      index: null,
      table_data: [], //达人搜索数据
      switchValue: false, //直播提醒
      // 选择时间 不可选的日期
      pickeroptions: {
        disabledDate: time => {
          return time.getTime() < Date.now() - 24 * 60 * 60 * 1000; // 返回 所有时间 大于 当前时间
        }
      },
      custom: false, //时间自定义
      roomLoading: false,
      showHotRoom: false,
      choiceValue: '6小时',
      active: '',
      //弹窗
      Popup: false,
      input01: '',
      input02: '',
      value: '已完成',
      value1: [new Date(), new Date().getTime() + 24 * 60 * 60 * 1000],
      value11: '',
      options: ['未开始', '监测中', '已完成', '已取消']
    };
  },
  computed: {},
  created() {
    this.LiveMonitoringHistory();
    // this.GetLiveMonitoringUseNum();
    // this.startMonitoring()
  },
  mounted() {},
  watch: {
    // 监测状态
    value(newvalue) {
      this.del = false;
      if (newvalue == '全部') {
        this.MonitoringState = '';
      } else if (newvalue == '未开始') {
        this.MonitoringState = 0;
      } else if (newvalue == '监测中') {
        this.MonitoringState = 1;
      } else if (newvalue == '已完成') {
        this.MonitoringState = 2;
      } else if (newvalue == '已取消') {
        this.MonitoringState = 3;
      }
      this.LiveMonitoring = [];
      this.LiveMonitoringHistory();
    },
    // 搜索内容变空时，刷新接口
    input01: function (newVal, oldVal) {
      if (newVal == '') {
        this.LiveMonitoring = [];
        this.page = 1;
        this.LiveMonitoringHistory();
      }
    }
  },
  methods: {
    // 管理
    but_admin() {
      this.del = !this.del;
    },
    talentDetails(id) {
      let router = this.$router.resolve({
        path: `/talent_main/tdetails/${id}/${0}`
      });
      window.open(router.href, '_blank');
    },
    // 取消和删除调取返回次数接口
    GetLiveMonitoringReturnNum() {
      this.$axios
        .post('/api/Live/GetLiveMonitoringReturnNum', {
          LiveMonitoringConfigID: this.id2
        })
        .then(res => {
          if (res.data.code == 0) {
            this.num = res.data.data;
          } else {
            this.frequency.useNum = 1;
          }
        });
    },
    // 分页
    get_data(cpage) {
      if (cpage) {
        this.page = cpage;
      } else {
        this.page = 1;
      }

      this.sonALL = [];
      this.LiveMonitoringHistory1();
    },
    close() {
      this.custom = false;
      this.choiceValue = '6小时';
      this.showInclude = false;
      // if( this.frequency){
      //  this.frequency.useNum = 1;
      // }
    },
    go_to_page01(id) {
      let router = this.$router.resolve({
        path: `/talent_main/tdetails/${id}/${0}`
      });
      window.open(router.href, '_blank');
    },
    // 重新检测
    LiveMonitorAgain(id, name, dyh) {
      this.Hour = '6';
      this.showHotRoom = true;
      this.table_data = [];
      this.index = dyh;
      this.author_id = id;
      this.input02 = name;
      this.getData();
      this.GetLiveMonitoringUseNum();
    },
    //点击监控场次
    monitorList(i, id) {
      this.page = 1;
      this.sonALL = [];
      this.AuthorId = id;
      this.popupList = true;
      this.LiveMonitoringHistory1();
      this.son = this.LiveMonitoring[i];

      // if(this.son.length==0){
      //   this.son=null
      // }
    },
    // 删除直播监测提示
    LiveMonitorDel(id, monitoringState) {
      this.id = id;
      this.monitoringState1 = monitoringState;
      this.id2 = id;
      this.dialogVisible = true;
      this.GetLiveMonitoringReturnNum();
    },
    // 删除监控
    dialog() {
      this.$axios
        .get('/api/Live/LiveMonitorDel', {
          params: { LiveMonitoringConfigID: this.id }
        })
        .then(res => {
          this.LiveMonitoring = [];
          this.LiveMonitoringHistory();
        })
        .catch(err => {
          console.log(err);
        });
      this.dialogVisible = false;
    },
    dialog1() {
      this.dialogVisible1 = false;

      this.$axios
        .get('/api/Live/LiveMonitorCancel', {
          params: { LiveMonitoringConfigID: this.id1 }
        })
        .then(res => {
          if (res.data.code == 1001) {
            this.$message({
              message: res.data.msg,
              duration: 2000,
              customClass: 'includeMessage',
              offset: 154
            });
          }
          this.LiveMonitoring = [];
          this.LiveMonitoringHistory();
        })
        .catch(err => {
          console.log(err);
        });
    },
    // 取消直播监测
    LiveMonitorCancel(id) {
      this.dialogVisible1 = true;
      this.id1 = id;
      this.id2 = id;
      this.GetLiveMonitoringReturnNum();
    },
    // 直播监测列表接口
    LiveMonitoringHistory() {
      this.listLoading = true;
      this.$axios
        .post('/api/Live/LiveMonitoring', {
          MonitoringState: this.MonitoringState,
          keyword: this.input01
        })
        .then(res => {
          if (res.data.code == 0) {
            this.LiveMonitoring = res.data.data;
            this.listLoading = false;
            if(!this.LiveMonitoring.length){
              this.del = false;
            }
          }
        });
    },
    todetails(room_id, author_id, status) {
      if (status == 1) {
        var id = room_id;
        let router = this.$router.resolve({
          path: `/live/${id}`
        });
        window.open(router.href, '_blank');
      } else {
        var id = room_id;
        let router = this.$router.resolve({
          path: `/talent_main/liveDetailsRoot/${id}/${0}`
        });
        window.open(router.href, '_blank');
      }
    },
    LiveMonitoringHistory1() {
      this.loading = true;
      this.sonlistLoading = true;
      this.$axios
        .post('/api/Live/LiveMonitoringHistory', {
          liveMonitoringConfigID: this.AuthorId,
          page: this.page,
          size: 5
        })
        .then(res => {
          if (res.data.code == 0) {
            this.total = res.data.count;
            this.sonALL = res.data.data;
            this.loading = false;
            this.sonlistLoading = false;
          } else {
            this.loading = false;
            this.sonlistLoading = false;
          }
        });
    },
    // 开始监测
    startMonitoring() {
      if (this.shake) return;
      setTimeout(() => {
        this.shake = false;
      }, 2100);
      this.$axios
        .post('/api/Live/LiveMonitor', {
          AuthorId: this.author_id,
          IsRemind: this.switchValue,
          Hour: this.Hour,
          Start: this.Start,
          Stop: this.Stop
        })
        .then(res => {
          if (res.data.code == 0) {
            this.showHotRoom = false;
            this.LiveMonitoring = [];
            this.table_data = [];
            this.custom = false;
            this.LiveMonitoringHistory();
            this.choiceValue = '6小时';
            this.frequency.useNum = 1;
          }
          if (res.data.code == 1001) {
            this.shake = true;
            this.$message({
              message: res.data.msg,
              duration: 2000,
              customClass: 'includeMessage',
              offset: 154
            });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },
    // 获取直播监测使用数量和剩余数量
    GetLiveMonitoringUseNum() {
      if (this.Start) {
        if (this.Start == this.Stop) {
          if (this.frequency) {
            this.frequency.useNum = 0;
            return;
          }
        }
      }
      this.$axios
        .post('/api/Live/GetLiveMonitoringUseNum', {
          Hour: this.Hour,
          Start: this.Start,
          Stop: this.Stop
        })
        .then(res => {
          if (res.data.code == 0) {
            this.frequency = res.data.data;
          }
        });
    },
    //时分秒换算
    date_format(micro_second) {
      // 总秒数
      var second = Math.floor(micro_second / 1000);
      // 天数
      var day = Math.floor(second / 3600 / 24);
      // 小时
      var hr = Math.floor((second / 3600) % 24);
      // 分钟
      var min = Math.floor((second / 60) % 60);
      // 秒
      var sec = Math.floor(second % 60);
      return day + '天' + hr + '小时' + min + '分钟' + sec + '秒';
    },
    //选择达人
    choiceTalent(i, author_id) {
      this.index = i;
      this.author_id = author_id;
    },
    // 选择时间
    changeTime() {
      if (this.value1 == null) {
        this.frequency.useNum = 0;
        this.value1 = [];
      }
      if (this.value1.length == 0) {
        this.choiceValue = [];
      } else {
        this.choiceValue = this.date_format(this.value1[1] - this.value1[0]);
        this.Start = this.timestamp(this.value1[0] / 1000, 'Y-M-D h:m:s');
        this.Stop = this.timestamp(this.value1[1] / 1000, 'Y-M-D h:m:s');
        this.GetLiveMonitoringUseNum();
      }
    },
    choice(i) {
      this.choiceValue = i;
      if (this.choiceValue == '6小时') {
        this.Hour = 6;
      } else if (this.choiceValue == '12小时') {
        this.Hour = 12;
      } else if (this.choiceValue == '24小时') {
        this.Hour = 24;
      } else if (this.choiceValue == '48小时') {
        this.Hour = 48;
      }
      if (this.choiceValue == '自定义') {
        this.value1 = [new Date(), new Date().getTime() + 24 * 60 * 60 * 1000];
        this.Start = this.timestamp(this.value1[0] / 1000, 'Y-M-D h:m:s');
        this.Stop = this.timestamp(this.value1[1] / 1000, 'Y-M-D h:m:s');
        this.custom = true;
        this.Hour = 0;
        this.frequency.useNum = 0;
        this.choiceValue = '24小时';
      } else {
        this.custom = false;
      }

      this.GetLiveMonitoringUseNum();
    },
    search_input() {
      this.table_data01 = [];
      this.getData();
    },
    search_input1() {
      this.LiveMonitoring = [];
      this.LiveMonitoringHistory();
    },
    //显示弹窗
    add() {
      this.Hour = 6;
      this.table_data = [];
      this.input02 = '';
      this.showHotRoom = true;
      this.GetLiveMonitoringUseNum();
    },
    // 达人搜索
    getData(cpage) {
      this.table_data = [];
      let that = this;
      that.roomLoading = true;
      this.$axios
        .post('/api/author/search', {
          age: '不限',
          category: 0,
          city: '不限',
          fans: '不限', // 粉丝数范围
          favorite_count: '不限', //点赞数范围
          gender: 3,
          hint: '不限',
          is_shop: 0,
          is_top_sale: 0,
          keyword: this.input02,
          more_age: '不限',
          more_city: '不限',
          more_gender: 3,
          more_province: '不限',
          more_star: '不限',
          order_by: 'desc',
          page: '1',
          pro_count: '不限',
          province: '不限',
          size: '20',
          sort: 'totalfans',
          star: '不限',
          verify_type: '3',
          video_count: '不限' // 作品数
        })
        .then(response => {
          if (response.data.code == 0) {
            this.table_data = response.data.data;

            this.index = response.data.data[0].unique_id;
            this.author_id = response.data.data[0].author_id;
            this.roomLoading = false;
            this.showInclude = false;
          } else if (response.data.code == 1002) {
            this.showInclude = true;
            this.roomLoading = false;
          }
        })
        .catch(error => {
          console.log(error);
        });
    }
  }
};
</script>

<style scoped lang="less">
#liveMonitorCon {
  background-color: #ffffff;
  min-height: 86vh;
  position: relative;
  /* 搜索框 */
  .imgBox {
    background: url('../../../../assets/wang/talentCompare/search-nohover.png') no-repeat 10px 7px,
      #fff !important;
    background-size: 15px 15px !important;
  }
  .imgBox:hover {
    background: url('../../../../assets/wang/talentCompare/search.png') no-repeat 10px 7px, #fff !important;
    background-size: 15px 15px !important;
  }
  .header {
    padding-left: 20px;
    padding-top: 20px;
    padding-bottom: 15px;
    padding-right: 20px;
    .section_01 {
      display: flex;
      justify-content: space-between;
      .section_box {
        display: flex;
      }
    }
    .tit {
      width: 56px;
      height: 14px;
      font-size: 14px;
      line-height: 30px;
      letter-spacing: 0px;
      color: #555555;
      padding-right: 10px;
    }
    .input_group {
      display: inline-block;
      margin-left: 11px;
      position: relative;
      width: 308px;
      overflow: hidden;
      height: 32px;
      border-radius: 4px 4px 4px 4px;
      border: solid 1px #e5e5e5;
      box-sizing: border-box;
      input {
        width: 100%;
        font-size: 14px;
        vertical-align: -1px;
        // background-color: #f5f5f5;
        height: 100%;
        box-sizing: border-box;
        padding-left: 11px;
        padding-right: 38px;
        border: none;
        color: #222;
      }
      input::-webkit-input-placeholder {
        color: #b5b5b5 !important;
      }
      > div {
        position: absolute;
        right: 0;
        cursor: pointer;
        top: 0px;
        text-align: center;
        width: 38px;
        height: 30px;
        border-radius: 0px 4px 4px 0px;
        display: flex;
        align-items: center;
        justify-content: center;
        img {
          width: 15px;
        }
      }
    }
    .but_complete {
      width: 77px;
      height: 32px;
      border-radius: 4px;
      border: solid 1px #fd7f2c;
      font-size: 14px;
      line-height: 28px;
      letter-spacing: 0px;
      color: #fd7f2c;
      position: relative;
      top: 1px;
      margin-right: 10px;
    }

    .but_admin {
      width: 77px;
      height: 32px;
      font-size: 14px;
      line-height: 28px;
      color: #222222;
      border-radius: 4px;
      border: solid 1px #e6e6e6;
      position: relative;
      top: 1px;
      margin-right: 10px;
      > img {
        width: 14px;
        height: 13px;
        vertical-align: middle;
        margin-top: -2px;
      }
    }
    .add {
      float: right;
      padding: 0 15px;
      height: 32px;
      background-color: #fd7f2c;
      border-radius: 4px;
      font-size: 14px;
      line-height: 30px;
      color: #ffffff;
      > img {
        width: 12px;
        height: 12px;
        margin-top: -3px;
      }
    }
  }
  .ul {
    width: 100%;
    // min-height: 500px;
    padding-left: 20px;
    padding-right: 20px;
    display: flex;
    box-sizing: border-box;
    flex-wrap: wrap;
    // justify-content: space-between;

    li {
      width: 25%;
      box-sizing: border-box;
      padding-right: 10px;
      &:nth-child(4n) {
        padding-right: 0;
      }
      .item_box {
        padding-left: 15px;
        padding-right: 15px;
        height: 151px;
        background-color: #ffffff;
        box-shadow: 0px 0px 16px 0px rgba(241, 241, 241, 0.8);
        border-radius: 4px;
        margin-bottom: 10px;
        box-sizing: border-box;
        padding-top: 20px;
      }
      .top {
        position: relative;
        width: 100%;
        display: flex;
        justify-content: space-between;
        padding-bottom: 15px;
        border-bottom: 1px solid #e5e5e5;
        .gif {
          position: absolute;
          cursor: pointer;
          top: -5px;
          left: -5px;
          width: 60px;
          height: 60px;
          animation: rainbow 3s linear infinite normal;
        }
        .logo {
          width: 50px;
          height: 50px;
          border-radius: 50%;
          background-color: #ffffff;
          margin-right: 10px;
          cursor: pointer;
        }
        .cen {
          width: 0;
          flex: 1;
          .name {
            &:hover {
              color: #fd7f2c !important;
            }
            // display: inline-block;
            // width: 150px;
            cursor: pointer;
            max-width: 180px;
            font-size: 14px;
            font-weight: 600;
            color: #222222;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            padding-bottom: 3px;
            padding-top: 6px;
            box-sizing: border-box;
          }
          > p {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            // width: 150px;
            padding: 1px 0;
            font-size: 14px;
            letter-spacing: 0px;
            color: #888888;
          }
        }
        .rig {
          align-self: center;
          > button {
            width: 100px;
            height: 34px;
            border-radius: 4px;
            border: solid 1px #fd7f2c;
            font-size: 14px;
            line-height: 30px;
            letter-spacing: 0px;
            color: #fd7f2c;
            box-sizing: border-box;
            &:hover {
              border: 1px solid #ff924b;
              color: #ff924b;
            }
          }
          .again {
            box-sizing: border-box;
            width: 100px;
            height: 34px;
            border: 1px solid #fd7f2c;
            border-radius: 4px;
            font-size: 14px;
            line-height: 30px;
            letter-spacing: 0px;
            color: #fd7f2c;
            &:hover {
              border-color: #ff924b;
              color: #ff924b;
            }
          }
          // .rigMonitoring {
          //   box-sizing: border-box;
          //   padding-top: 20px;
          //   font-size: 14px;
          //   font-weight: 600;
          //   color: #fd7f2c;
          //   > img {
          //     width: 14px;
          //     height: 14px;
          //     margin-top: -2px;
          //   }
          // }
          // // width: 42px;
          // .notStarted {
          //   padding-top: 16px;
          //   // width: 42px;
          //   font-size: 14px;
          //   line-height: 30px;
          //   color: #888888;
          // }
        }
      }
      .bot {
        padding-top: 10px;
        .monitor {
          display: flex;
          justify-content: space-between;
          padding-bottom: 7px;
          .timeSlot {
            font-size: 13px;
            letter-spacing: 0px;
            color: #888888;
          }
          .Sessions:hover {
            color: #ff924b;
          }
          .Sessions {
            font-size: 13px;
            letter-spacing: 0px;
            color: #555555;
            cursor: pointer;
            > span {
              cursor: pointer;
              font-family: DINAlternate-Bold;
              font-size: 13px;
              letter-spacing: 0px;
              color: #fd7f2c;
            }
          }
        }
        .monitorTime {
          font-size: 13px;
          letter-spacing: 0px;
          color: #222222;
        }

        .delCancel {
          display: flex;
          justify-content: flex-end;
          font-size: 14px;
          letter-spacing: 0px;
          color: #888888;
          padding-top: 4px;
          .rigbor {
            width: 1px;
            height: 10px;
            background-color: #e5e5e5;
            margin-top: 5px;
          }
          .del {
            cursor: pointer;
            padding-right: 10px;
          }

          .del:hover {
            color: #ea1b0b;
          }
          .cancel {
            cursor: pointer;
            padding-left: 10px;
          }
          .cancel:hover {
            color: #ea1b0b;
          }
        }
      }
    }
  }
  .hotRoomBox {
    width: 572px;
    height: 600px;
    overflow: auto;
    padding: 20px 20px;
    border-radius: 4px;
    box-sizing: border-box;
    .active_Talent {
      border: 1px solid #fd7f2c !important;
    }
    .addIncludeBtn {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 110px;
      height: 40px;
      line-height: 40px;
      background-color: #fd7f2c;
      border-radius: 4px;
      margin: 0 auto;
      margin-top: 30px;
      cursor: pointer;
      img {
        width: 16px;
        height: 16px;
        margin-right: 5px;
      }
      span {
        font-size: 14px;
        color: #ffffff;
      }
    }
    .Talent_list {
      height: 250px;
      width: 370px;
      margin: auto;
      overflow-y: scroll;
      overflow-x: hidden;
      margin-top: 20px;

      > li {
        display: flex;
        width: 350px;
        height: 77px;
        background-color: #ffffff;
        border-radius: 4px;
        border: solid 1px #e5e5e5;
        margin-bottom: 15px;
        padding: 12px 14px;
        box-sizing: border-box;
        position: relative;
        cursor: pointer;
        > div {
          &:nth-child(1) {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            > img {
              width: 100%;
              height: 100%;
              border-radius: 50%;
            }
          }
          &:nth-child(2) {
            margin-left: 8px;
            max-width: 224px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin-top: 5px;
            flex: 1;
            > p {
              &:nth-child(1) {
                font-size: 14px;
                margin-bottom: 1px;
                font-weight: 600;
                letter-spacing: 0px;
                color: #222222;
                max-width: 210px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                margin-bottom: 3px;
              }
              &:nth-child(2) {
                margin-bottom: 1px;
                font-size: 14px;
                letter-spacing: 0px;
                color: #888888;
                max-width: 210px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
              }
              &:nth-child(3) {
                font-size: 14px;
                letter-spacing: 0px;
                color: #888888;
                max-width: 210px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
              }
            }
          }
          &:nth-child(3) {
            position: absolute;
            right: 20px;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            // margin-top: 22px;
            align-self: center;

            > img {
              width: 100%;
              height: 100%;
              border-radius: 50%;
              vertical-align: top;
            }
          }
        }
      }
    }
    .title {
      font-size: 16px;
      font-weight: 600;
      letter-spacing: 0px;
      color: #222222;
      position: relative;
      text-indent: 9px;
      &::after {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 4px;
        height: 16px;
        background-color: #fd7f2c;
        border-radius: 2px;
      }
    }
    .txt {
      width: 532px;
      font-size: 13px;
      padding: 13px 0;
      box-sizing: border-box;
      letter-spacing: 0px;
      color: #888888;
      border-bottom: 1px solid #e5e5e5;
      margin-bottom: 20px;
    }
    .input_group {
      display: inline-block;
      position: relative;
      left: 80px;
      overflow: hidden;
      width: 370px;
      height: 32px;
      border-radius: 4px 4px 4px 4px;
      border: solid 2px #fd7f2c;
      box-sizing: border-box;
      input {
        width: 100%;
        font-size: 14px;
        vertical-align: -1px;
        height: 100%;
        box-sizing: border-box;
        padding-left: 11px;
        padding-right: 38px;
        border: none;
        color: #222;
      }
      input::-webkit-input-placeholder {
        color: #b5b5b5 !important;
      }
      > div {
        position: absolute;
        right: 0;
        cursor: pointer;
        top: -2px;
        text-align: center;
        width: 38px;
        height: 32px;
        background-color: #fd7f2c;
        border-radius: 0px 4px 4px 0px;
        display: flex;
        align-items: center;
        justify-content: center;
        img {
          width: 15px;
        }
      }
    }
    .duration {
      width: 372px;
      font-size: 14px;
      font-weight: 600;
      letter-spacing: 0px;
      color: #222222;
      padding-top: 17px;
      padding-bottom: 14px;
      margin: auto;
      > span {
        font-size: 12px;
        color: #888888;
        font-weight: 400;
        float: right;
      }
    }
    .choice {
      display: flex;
      width: 370px;
      border: solid 1px #e5e5e5;
      border-radius: 4px;

      margin: auto;
      overflow: hidden;
      > button {
        font-size: 14px;
        width: 78px;
        height: 32px;
        line-height: 32px;
        text-align: center;
        background-color: #ffffff;
        border-right: solid 1px #e5e5e5;

        padding: 0 !important;
        &:nth-child(5) {
          border-right: none;
        }
      }
      .active {
        background: #fd7f2c;
        color: #fff;
      }
    }
    .tips {
      padding-top: 8px;
      width: 372px;
      margin: auto;
      font-size: 12px;
      font-weight: normal;
      font-stretch: normal;
      line-height: 18px;
      letter-spacing: 0px;
      color: #888888;
    }
    .remind {
      width: 370px;
      margin: auto;
      margin-top: 5px;
      > span {
        font-size: 14px;
        font-weight: 600;
        line-height: 30px;
        letter-spacing: 0px;
        color: #222222;
      }
    }
    .push {
      width: 370px;
      margin: auto;
      font-size: 12px;
      font-weight: normal;
      font-stretch: normal;
      letter-spacing: 0px;
      color: #555555;
      margin-top: 5px;
    }
    .rule {
      width: 370px;
      margin: auto;
      font-size: 12px;
      font-weight: normal;
      line-height: 20px;
      letter-spacing: 0px;
      color: #888888;
      margin-top: 10px;
    }
    .frequency {
      width: 370px;
      line-height: 26px;
      margin: auto;
      margin-top: 20px;
      background: #fafafa;
      // width: 316px;
      text-align: center;
      font-size: 12px;
      letter-spacing: 0px;
      color: #222222;
      > span {
        color: #fd7f2c;
      }
    }
    .testing {
      width: 370px;
      margin: auto;
      text-align: center;
      margin-top: 20px;
      > button {
        width: 258px;
        height: 46px;
        font-size: 14px;
        background-color: #fd7f2c;
        border-radius: 4px;
        text-align: center;
        color: #fff;
      }
    }
  }
  .disabled {
    cursor: no-drop;
  }
  @keyframes rainbow {
    0% {
      transform: rotate(0deg);
    }
    50% {
      transform: rotate(180deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }
  .popupList {
    padding: 20px;
    // padding: 20px 15px;
    box-sizing: border-box;
    height: 590px;
    .complete {
      font-size: 16px;
      font-weight: 600;
      // line-height: 30px;
      letter-spacing: 0px;
      text-align: left;
      color: #222222;
    }
    > ul {
      li {
        border-bottom: 1px solid #efefef;
        box-sizing: border-box;
      }
    }
  }
  .sonlistLoading {
    width: 150px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
  .details {
    position: absolute;
    right: 32px;
    display: inline-block;
    width: 88px;
    height: 32px;
    font-size: 14px;
    background-color: #fd7f2c;
    border-radius: 4px;
    text-align: center;
    color: #fff;
    align-self: center;
  }
  .details:hover {
    background: #ff924b;
  }
}
@media screen and (max-width: 1400px) {
  #liveMonitorCon .ul li {
    width: 33.33%;
    padding-right: 10px !important;
    &:nth-child(3n) {
      padding-right: 0;
    }
  }
}
// @media screen and (max-width:1350px){
//  #liveMonitorCon .ul li{
//     width: 50%;
//     &:nth-child(2n){
//       padding-right: 0;
//     }
//  }
// }
</style>
